Basically I want to load some data into my algo using 'fetch_csv' and I also need the recent bars in 'handle_data'. This security symbol is outside of Quantopian's symbol database. I tried to supply the data as 'Security Information' or 'Signals', but neither works.
For example:
def initialize(context):
context.i = 0
context.window = 5
url = 'http://7u2o2u.com1.z0.glb.clouddn.com/@/csi300/csi300.csv'
fetch_csv(url, mask=False, symbol='CSI300')
# url = 'http://7u2o2u.com1.z0.glb.clouddn.com/@/csi300/csi300_symbol.csv'
# fetch_csv(url, mask=False)
# context.symbol = symbol('CSI300')
add_history(4, '1d', 'high')
add_history(4, '1d', 'low')
def task1(high, low):
return False
def task2(high, low):
return False
def handle_data(context, data):
# Skip first 4 days to get full windows
context.i += 1
if context.i < context.window:
return
high_hist = history(4, '1d', 'high')
low_hist = history(4, '1d', 'low')
At the last two lines, only AAPL history data is available.
The 'csi300.csv' looks like:
date,open,high,low,close,volume,price
2014-01-02 00:00:00+00:00,2323.433,2325.991,2310.653,2321.978,4519429100.0,2321.978
and 'csi300_symbol.csv' looks like:
date,open,high,low,close,volume,price,symbol
2014-01-02 00:00:00+00:00,2323.433,2325.991,2310.653,2321.978,4519429100.0,2321.978,CSI300
How should I do with this please?